/*  %{和%}之间的代码会被原样照抄生成到c文件的开头部分*/
%{
int yywrap (void)
{
	return 1;
}
int chars = 0;
int words = 0;
int lines = 0;
%}
%%
[a-zA-Z]+	{ words++; chars += strlen(yytext); }
\n		{ chars++; lines++; }
.		{ chars++; }
%%

main(int argc,char* argv[])
{
	yylex();
	printf("words = %d;chars = %d;lines = %d;\n",words,chars,lines);
}
